<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 字符串 ==> 对象
      // {"key":111,"key":"111"}
      var str = '{"name":"cxm","age":100}'
      console.log(str) //{"name":"cxm","age":100}
      var obj = JSON.parse(str)
      console.log(obj) //{name: 'cxm', age: 100}

      // 前端==>后端
      var obj1 = { name: 'cxm', age: 100 }
      console.log(obj1) //{name: 'cxm', age: 100}
      var str1 = JSON.stringify(obj1)
      console.log(str1) //{"name":"cxm","age":100}
    </script>
  </body>
</html>
